#pragma once

#include "api/p2pms_client_interface.hpp"
#include "task_queue.hpp"
#include "p2pms_client_impl.hpp"

namespace p2pms
{

//==================================================================================================
// 
//==================================================================================================
class P2PMSClient : public IP2PMSClient
{
public:
	P2PMSClient();
	~P2PMSClient();

	// IP2PMSClient interface methods
	ErrCode Init(IMainThreadExecutor* executor, IClientHandler* handler, 
		const std::string& server_addr) override;
	ErrCode Login(const std::string& user_id) override;
	void Logout() override;
	std::vector<std::string> GetUserList() override;
	ErrCode MakeCall(CallMode mode, const std::string& callee_id) override;
	void TerminateCall() override;
	ErrCode StartPublish(const MediaDevice& device, MediaInfo& media) override;
	ErrCode StopPublish(const MediaInfo& media) override;
	ErrCode StartSubscribe(const std::string& user_id, const MediaInfo& media) override;
	ErrCode StopSubscribe(const std::string& user_id, const MediaInfo& media) override;
	IRendererManager* GetRendererManager() override;
	IDeviceManager* GetDeviceManager() override;
	
private:
	std::unique_ptr<rtc::Thread> m_sdk_thread;
	P2PMSClientImpl m_impl;
};

}